<!--
 * @Author: lilin_:）
 * @version: 1.0
 * @Descripttion: 发票台账
 * @Date: 2021-08-23 12:31:34
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2022-05-07 14:07:15
-->
<template>
	<div class="system-user-container">
		<el-card class="box-card">
			<div>
				<!-- 顶部搜索 -->
				<div class="my_btn_lay">
					<div class="my_flex my_btn" @click="searchEvent">
						<div class="my_flex_layout">
							<i class="vxe-icon--search"></i>
							<span>查找</span>
						</div>
					</div>

					<div class="my_flex my_btn ml20" @click="resetEvent">
						<div class="my_flex_layout">
							<i class="vxe-icon--refresh"></i>
							<span>重置</span>
						</div>
					</div>

					<div class="my_flex my_btn ml20" @click="addDefaultBlank">
						<div class="my_flex_layout">
							<i class="vxe-icon--plus"></i>
							<span>新增</span>
						</div>
					</div>

					<div class="my_flex my_btn ml20" @click="deleteTable">
						<div class="my_flex_layout">
							<i class="fa fa-trash-o"></i>
							<span>删除</span>
						</div>
					</div>

					<div class="my_flex my_btn ml20" @click="uploadingbutton">
						<div class="my_flex_layout">
							<i class="vxe-icon--upload"></i>
							<span>导入</span>
						</div>
					</div>

					<div class="my_flex my_btn ml20" @click="funnelEvent">
						<div class="my_flex_layout">
							<i class="vxe-icon--download"></i>
							<span>导出</span>
						</div>
					</div>

					<div class="my_flex my_btn ml20" @click="printTab">
						<div class="my_flex_layout">
							<i class="vxe-icon--print"></i>
							<span>打印</span>
						</div>
					</div>

					<div class="my_flex my_btn ml20" @click="showBasicsVarSet">
						<div class="my_flex_layout">
							<i class="vxe-icon--edit-outline"></i>
							<span>变量类型</span>
						</div>
					</div>

					<div class="my_flex my_btn ml20" @click="add_shouw">
						<div class="my_flex_layout">
							<i class="vxe-icon--edit-outline"></i>
							<span>发票类型</span>
						</div>
					</div>

					<div class="my_flex my_btn ml20" @click="addTaxBtn">
						<div class="my_flex_layout">
							<i class="vxe-icon--edit-outline"></i>
							<span>税率</span>
						</div>
					</div>

					<div class="my_flex my_btn ml20" @click="showAmendFun">
						<div class="my_flex_layout">
							<i class="el-icon-edit"></i>
							<span>编辑</span>
						</div>
					</div>
					<div class="my_flex my_btn ml20" @click="editClosedEvent">
						<div class="my_flex_layout">
							<i class="el-icon-folder-add"></i>
							<span>保存</span>
						</div>
					</div>
				</div>

				<!-- title-width="0" -->
				<!-- folding 是否隐藏 -->
				<vxe-form :data="selectFrom" title-align="left" prevent-submit title-colon>
					<vxe-form-item title="单位名称" field="contractUnit" span="6" :item-render="{}">
						<template #default="{ data }">
							<el-select style="width: 100%" clearable filterable v-model="data.contractUnit" placeholder="请选择单位名称">
								<el-option v-for="item in unitsData" :key="item.id" :label="item.unitName" :value="item.id"> </el-option>
							</el-select>
						</template>
					</vxe-form-item>
					<vxe-form-item title="项目名称" field="contractName" span="6" :item-render="{}">
						<template #default="{ data }">
							<el-select style="width: 100%" clearable filterable v-model="data.contractName" placeholder="请选择项目名称">
								<el-option v-for="item in projectData" :key="item.id" :label="item.contractName" :value="item.id"> </el-option>
							</el-select>
						</template>
					</vxe-form-item>
					<vxe-form-item title="发票类型" field="managerName" span="6" :item-render="{}">
						<template #default="{ data }">
							<el-select style="width: 100%" clearable filterable v-model="data.managerName" placeholder="请选择发票类型">
								<!-- <el-option v-for="item in operator" :key="item.id" :label="item.contactPerson" :value="item.id"> </el-option> -->
								<el-option v-for="item in bankFrom.shoWData" :key="item.id" :label="item.type" :value="item.id"></el-option>
							</el-select>
						</template>
					</vxe-form-item>

					<vxe-form-item title="是否作废 " field="invalid" span="6" :item-render="{}">
						<template #default="{ data }">
							<el-select style="width: 100%" v-model="data.invalid" clearable placeholder="是否作废">
								<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"> </el-option>
							</el-select>
						</template>
					</vxe-form-item>

					<vxe-form-item title="金额范围" field="billMoneyStart" :item-render="{}" span="6">
						<template #default="{ data }">
							<div class="money_scope" style="width: 100%">
								<el-input v-model="data.billMoneyStart" placeholder="启始值" style="width: 40%">
									<!-- <template #prepend>启始金额</template> -->
								</el-input>
								<i class="el-icon-minus"></i>
								<!-- <div class="Minus"> 
								 </div> -->
								<el-input v-model="data.billMoneyEND" placeholder="结束值" style="width: 40%">
									<!-- <template #append>截止金额</template> -->
								</el-input>
							</div>
						</template>
					</vxe-form-item>

					<!-- <vxe-form-item title="开票时间" field="time" span="6" :item-render="{}">
						<template #default="{ data }">
							<el-date-picker
								style="width: 100%"
								v-model="data.time"
								type="datetimerange"
								range-separator="至"
								start-placeholder="开始日期"
								end-placeholder="结束日期"
								value-format="YYYY-MM-DD HH:mm:ss"
							>
							</el-date-picker>
						</template>
					</vxe-form-item> -->

					<vxe-form-item title="开始时间" field="time" span="6" :item-render="{}">
						<template #default="{ data }">
							<el-date-picker value-format="YYYY-MM-DD HH:mm:ss" v-model="data.time1" type="date" placeholder="开始时间"> </el-date-picker>
						</template>
					</vxe-form-item>

					<vxe-form-item title="结束时间" field="time" span="6" :item-render="{}">
						<template #default="{ data }">
							<el-date-picker value-format="YYYY-MM-DD HH:mm:ss" v-model="data.time2" type="date" placeholder="结束日期"> </el-date-picker>
						</template>
					</vxe-form-item>

					<vxe-form-item title="税率" field="tax" span="6" :item-render="{}">
						<template #default="{ data }">
							<el-select style="width: 100%" v-model="data.tax" clearable placeholder="税率">
								<el-option v-for="item in taxFrom.shoWData" :key="item.id" :label="item.taxRate" :value="item.taxRate">
									<span style="float: left">{{ item.taxRate }}</span>
									<span style="float: right; color: var(--el-text-color-secondary); font-size: 13px">%</span>
								</el-option>
							</el-select>
						</template>
					</vxe-form-item>

					<!-- 
					<vxe-form-item align="right" span="24" collapse-node>
						<template #default>
							<vxe-button status="primary" content="搜索" @click="searchEvent"></vxe-button>
							<vxe-button content="重置" @click="resetEvent"></vxe-button>
						</template>
					</vxe-form-item> -->
				</vxe-form>
				<!-- 
				<vxe-toolbar ref="xToolbar" custom>
					<template #buttons>
						<vxe-button type="text" icon="fa fa-plus" content="新增" @click="addDefaultBlank"></vxe-button>
						<vxe-button type="text" icon="fa fa-trash-o" content="删除" @click="deleteTable"></vxe-button>
						<vxe-button type="text" icon="fa fa-plus" content="查看发票类型" @click="add_shouw"></vxe-button>
					</template>
					<template #tools>
						<vxe-button type="text" icon="vxe-icon--edit-outline" @click="showBasicsVarSet" class="tool-btn"></vxe-button>
						<vxe-button type="text" icon="vxe-icon--print" class="tool-btn" @click="printTab"></vxe-button>
						<vxe-button type="text" icon="vxe-icon--download" class="tool-btn" @click="funnelEvent"></vxe-button>
					</template>
				</vxe-toolbar> -->
				<!-- :edit-config="{ trigger: 'click', mode: 'row' }" -->
				<!-- @edit-closed="editClosedEvent" -->
				<vxe-table
					:height="725"
					border
					:scroll-x="{ enabled: false }"
					:scroll-y="{ enabled: false }"
					keep-source
					ref="xTable1"
					:export-config="{}"
					resizable
					align="center"
					show-overflow
					:data="invoiceLedgerTableData"
					:edit-config="{ trigger: 'manual', mode: 'row', icon: 'false' }"
					class="mytable-style"
					:row-class-name="rowClassName"
					:edit-rules="validRules"
					@checkbox-change="selectChangeEvent1"
					@checkbox-all="selectAllChangeEvent1"
					show-footer
					:footer-method="footerMethod"
				>
					<vxe-column align="center" type="checkbox" width="40" fixed="left"></vxe-column>
					<vxe-column align="center" type="seq" title="序号" width="60"></vxe-column>
					<vxe-column
						width="105"
						field="time"
						title="开票时间"
						:edit-render="{ name: '$input', placeholder: '请选择日期', props: { type: 'date', placeholder: '请选择日期' } }"
					></vxe-column>
					<vxe-column width="100" field="billCode" title="发票代码" :edit-render="{ name: 'input' }"></vxe-column>
					<vxe-column width="100" field="billNum" title="发票号码" :edit-render="{ name: 'input' }"></vxe-column>

					<!-- <vxe-column width="130" field="contractUnit" title="单位名称" :edit-render="{ autofocus: '.custom-input' }">
						<template #edit="{ row }">
							<vxe-pulldown ref="xDown1" transfer>
								<template #default>
									<vxe-input v-model="row.contractUnit" placeholder="单位名称" @change="clickDownEvent"></vxe-input>
								</template>
								<template #dropdown>
									<div v-for="item in projectName" :key="item.value" @click="changeNameEvent(item, row)">
										<span class="lable_titel_item">{{ item.unitName }}</span>
									</div>
								</template>
							</vxe-pulldown>
						</template>
					</vxe-column> -->

					<vxe-column width="150" field="contractUnitId" title="单位名称" :edit-render="{ type: 'default' }">
						<template v-slot:edit="scope">
							<el-select clearable filterable v-model="scope.row.contractUnitId">
								<el-option
									v-for="item in unitsData"
									:key="item.id"
									:label="item.unitName"
									:value="item.id"
									@click="change_contractName(scope.row)"
								></el-option>
							</el-select>
						</template>
						<template v-slot="{ row }">{{ getSelectLabel(row.contractUnitId, unitsData) }}</template>
					</vxe-column>

					<!-- <vxe-column width="130" field="contractId" title="项目名称" :edit-render="{ type: 'default' }">
						<template v-slot:edit="scope">
							<el-select filterable v-model="scope.row.contractId" remote reserve-keyword >
								<el-option
									v-for="item in unitsData"
									:key="item.id"
									:label="item.unitName"
									:value="item.id"
									@click="change_contractName(item)"
								></el-option>
							</el-select>
						</template>
						<template v-slot="{ row }">{{ getSelectLabel(row.contractId, unitsData) }}</template>
					</vxe-column> -->

					<!-- <vxe-column width="130" field="contractName" title="项目名称" :edit-render="{ autofocus: '.custom-input' }">
						<template #edit="{ row }">
							<vxe-pulldown ref="xDown2" transfer>
								<template #default>
									<vxe-input v-model="row.contractName" placeholder="单位名称" @change="clickDownEvent_xDown2(row)"></vxe-input>
								</template>
								<template #dropdown>
									<div v-for="item in row.yuanData" :key="item.value" @click="changeNameEvent_xDown2(item, row)">
										<span class="lable_titel_item">{{ item.contractName }}</span>
									</div>
								</template>
							</vxe-pulldown>
						</template>
					</vxe-column> -->

					<vxe-column width="230" field="contractId" title="项目名称" :edit-render="{ type: 'default' }">
						<template v-slot:edit="scope">
							<el-select clearable filterable v-model="scope.row.contractId">
								<el-option v-for="item in scope.row.contractNameList1" :key="item.id" :label="item.contractName" :value="item.id"></el-option>
							</el-select>
						</template>
						<template v-slot="{ row }">{{ getSelectLabel_contractName(row.contractId, row.contractNameList1) }}</template>
					</vxe-column>

					<vxe-column width="80" field="monthProgress" title="月度产值" :edit-render="{ name: 'input' }">
						<template v-slot:edit="scope">
							<el-input v-model="scope.row.monthProgress" @change="change_monthProgress(scope.row)"></el-input>
						</template>
						<template v-slot="{ row }">{{ transitionNumber(row.monthProgress) }}</template>
					</vxe-column>
					<!-- 
					<vxe-column width="130" field="countProgress" title="累计进度量" :edit-render="{ name: 'input' }">
						<template v-slot:edit="scope">
							<el-input v-model="scope.row.countProgress"></el-input>
						</template>
						<template v-slot="{ row }">{{ transitionNumber(row.countProgress) }}</template>
					</vxe-column> -->

					<vxe-column width="100" field="billMoney" title="开票金额" :edit-render="{ name: 'input' }">
						<template v-slot:edit="scope">
							<el-input v-model="scope.row.billMoney" @change="change_sunbillMoney(scope.row)"></el-input>
						</template>
						<template v-slot="{ row }">{{ transitionNumber(row.billMoney) }}</template>
					</vxe-column>

					<!-- <vxe-column width="130" field="taxRate" title="税率" :edit-render="{ name: 'input' }">
						<template v-slot:edit="scope">
							<el-input v-model="scope.row.taxRate" @change="change_sunbillMoney(scope.row)"></el-input>
						</template>
					</vxe-column> -->

					<vxe-column width="80" field="taxRate" title="税率" :edit-render="{ type: 'default' }">
						<!-- <template v-slot:edit="scope">
							<el-input v-model="scope.row.taxRate" placeholder="请输入数值类型" @change="change_sunbillMoney(scope.row)">
								<template #append>%</template>
							</el-input>
						</template>
						<template v-slot="{ row }">{{ row.taxRate }}%</template> -->

						<template v-slot:edit="scope">
							<el-select clearable @change="change_sunbillMoney(scope.row)" filterable v-model="scope.row.taxRate">
								<el-option v-for="item in taxFrom.shoWData" :key="item.id" :label="item.taxRate" :value="item.taxRate"></el-option>
							</el-select>
						</template>
						<template v-slot="{ row }">{{ row.taxRate }}%</template>
					</vxe-column>

					<vxe-column width="100" field="unitPrice" title="单价" :edit-render="{ name: 'input' }">
						<template v-slot:edit="scope">
							<el-input v-model="scope.row.unitPrice" @change="change_VATcollection(scope.row)"></el-input>
						</template>
						<template v-slot="{ row }">{{ transitionNumber(row.unitPrice) }}</template>
					</vxe-column>

					<!-- <vxe-column width="130" field="vat" title="增值税额" :edit-render="{ name: 'input' }"></vxe-column> -->
					<vxe-column width="100" field="vat" title="增值税额" :edit-render="{ name: 'input' }">
						<template v-slot:edit="scope">
							<el-input v-model="scope.row.vat"></el-input>
						</template>
						<template v-slot="{ row }">{{ transitionNumber(row.vat) }}</template>
					</vxe-column>

					<!-- 
					<vxe-column width="130" title="增值税额" :edit-render="{ type: 'default' }">
						<template v-slot:edit="scope">
							<el-input v-model="scope.row.vat" placeholder="请输入数值类型">
								<template #append>%</template>
							</el-input>
						</template>
						<template v-slot="{ row }">{{ row.vat }}%</template>
					</vxe-column> -->

					<vxe-column width="110" field="prepaidVat" title="预交增值税" :edit-render="{ name: 'input' }">
						<template v-slot:edit="scope">
							<el-input v-model="scope.row.prepaidVat" @change="change_prepaidVat(scope.row)"></el-input>
						</template>
						<template v-slot="{ row }">{{ transitionNumber(row.prepaidVat) }}</template>
					</vxe-column>

					<!-- <vxe-column width="130" title="预交增值税" :edit-render="{ type: 'default' }">
						<template v-slot:edit="scope">
							<el-input v-model="scope.row.prepaidVat" @change="change_prepaidVat(scope.row)" placeholder="请输入数值类型">
								<template #append>%</template>
							</el-input>
						</template>
						<template v-slot="{ row }">{{ row.prepaidVat }}%</template>
					</vxe-column> -->

					<vxe-column width="130" field="subcontractorId" title="分包单位" :edit-render="{ type: 'default' }">
						<template v-slot:edit="scope">
							<el-select clearable filterable v-model="scope.row.subcontractorId">
								<el-option v-for="item in unitsData" :key="item.id" :label="item.unitName" :value="item.id"></el-option>
							</el-select>
						</template>
						<template v-slot="{ row }">{{ getSelectLabel(row.subcontractorId, unitsData) }}</template>
					</vxe-column>

					<!-- state.unitsData -->
					<vxe-column width="100" field="subcontractorDeductible" title="分包抵扣" :edit-render="{ name: 'input' }">
						<template v-slot="{ row }">{{ transitionNumber(row.subcontractorDeductible) }}</template>
					</vxe-column>
					<vxe-column width="125" field="subcontractorDeductibleVat" title="分包抵扣增值税" :edit-render="{ name: 'input' }">
						<template v-slot="{ row }">{{ transitionNumber(row.subcontractorDeductibleVat) }}</template>
					</vxe-column>

					<!-- <vxe-column width="130" title="分包抵扣增值税" :edit-render="{ type: 'default' }">
						<template v-slot:edit="scope">
							<el-input v-model="scope.row.subcontractorDeductibleVat" placeholder="请输入数值类型">
								<template #append>%</template>
							</el-input>
						</template>
						<template v-slot="{ row }">{{ row.subcontractorDeductibleVat }}%</template>
					</vxe-column> -->

					<vxe-column width="100" field="buildTax" title="城建税" :edit-render="{ name: 'input' }">
						<template v-slot:edit="scope">
							<el-input v-model="scope.row.buildTax"></el-input>
						</template>
						<template v-slot="{ row }">{{ transitionNumber(row.buildTax) }}</template>
					</vxe-column>

					<!-- <vxe-column width="130" title="城建税" :edit-render="{ type: 'default' }">
						<template v-slot:edit="scope">
							<el-input v-model="scope.row.buildTax" placeholder="请输入数值类型">
								<template #append>%</template>
							</el-input>
						</template>
						<template v-slot="{ row }">{{ row.buildTax }}%</template>
					</vxe-column> -->

					<vxe-column width="110" field="education" title="教育费附加税" :edit-render="{ name: 'input' }">
						<template v-slot:edit="scope">
							<el-input v-model="scope.row.education"></el-input>
						</template>
						<template v-slot="{ row }">{{ transitionNumber(row.education) }}</template>
					</vxe-column>

					<!-- <vxe-column width="130" title="教育费附加税" :edit-render="{ type: 'default' }">
						<template v-slot:edit="scope">
							<el-input v-model="scope.row.education" placeholder="请输入数值类型">
								<template #append>%</template>
							</el-input>
						</template>
						<template v-slot="{ row }">{{ row.education }}%</template>
					</vxe-column> -->

					<vxe-column width="135" field="localEducation" title="地方教育费附加税" :edit-render="{ name: 'input' }">
						<template v-slot:edit="scope">
							<el-input v-model="scope.row.localEducation"></el-input>
						</template>
						<template v-slot="{ row }">{{ transitionNumber(row.localEducation) }}</template>
					</vxe-column>

					<!-- <vxe-column width="130" title="地方教育费附加税" :edit-render="{ type: 'default' }">
						<template v-slot:edit="scope">
							<el-input v-model="scope.row.localEducation" placeholder="请输入数值类型">
								<template #append>%</template>
							</el-input>
						</template>
						<template v-slot="{ row }">{{ row.localEducation }}%</template>
					</vxe-column> -->

					<vxe-column width="100" field="subtotal" title="小计" :edit-render="{ name: 'input' }">
						<template v-slot:edit="scope">
							<el-input v-model="scope.row.subtotal"></el-input>
						</template>
						<template v-slot="{ row }">{{ transitionNumber(row.subtotal) }}</template>
					</vxe-column>

					<vxe-column width="100" field="personalIncomeTax" title="个人所得税" :edit-render="{ name: 'input' }">
						<template v-slot="{ row }">{{ transitionNumber(row.personalIncomeTax) }}</template>
					</vxe-column>
					<!-- 
					<vxe-column width="130" title="个人所得税" :edit-render="{ type: 'default' }">
						<template v-slot:edit="scope">
							<el-input v-model="scope.row.personalIncomeTax" placeholder="请输入数值类型">
								<template #append>%</template>
							</el-input>
						</template>
						<template v-slot="{ row }">{{ row.personalIncomeTax }}%</template>
					</vxe-column> -->

					<vxe-column width="100" field="corporateIncomeTax" title="企业所得税" :edit-render="{ name: 'input' }">
						<template v-slot:edit="scope">
							<el-input v-model="scope.row.corporateIncomeTax"></el-input>
						</template>
						<template v-slot="{ row }">{{ transitionNumber(row.corporateIncomeTax) }}</template>
					</vxe-column>

					<!-- <vxe-column width="130" title="企业所得税" :edit-render="{ type: 'default' }">
						<template v-slot:edit="scope">
							<el-input v-model="scope.row.corporateIncomeTax" placeholder="请输入数值类型">
								<template #append>%</template>
							</el-input>
						</template>
						<template v-slot="{ row }">{{ row.corporateIncomeTax }}%</template>
					</vxe-column> -->

					<vxe-column width="100" field="stampDuty" title="印花税" :edit-render="{ name: 'input' }"></vxe-column>

					<!-- <vxe-column width="130" title="印花税" :edit-render="{ type: 'default' }">
						<template v-slot:edit="scope">
							<el-input v-model="scope.row.stampDuty" placeholder="请输入数值类型">
								<template #append>%</template>
							</el-input>
						</template>
						<template v-slot="{ row }">{{ row.stampDuty }}%</template>
					</vxe-column> -->

					<vxe-column width="100" field="unionFunds" title="工会经费" :edit-render="{ name: 'input' }">
						<template v-slot="{ row }">{{ transitionNumber(row.unionFunds) }}</template>
					</vxe-column>
					<vxe-column width="110" field="waterFunds" title="水利建设基金" :edit-render="{ name: 'input' }">
						<template v-slot="{ row }">{{ transitionNumber(row.waterFunds) }}</template>
					</vxe-column>

					<!-- <vxe-column width="130" field="managerName" title="经办人" :edit-render="{ name: 'input' }"></vxe-column> -->

					<!-- <vxe-column width="130" field="managerId" title="经办人" :edit-render="{ type: 'default' }">
						<template v-slot:edit="scope">
							<el-select filterable v-model="scope.row.managerId">
								<el-option v-for="item in unitsData" :key="item.id" :label="item.contactPerson" :value="item.id"></el-option>
							</el-select>
						</template>
						<template v-slot="{ row }">{{ getSelectLabel_contactPerson(row.invoiceId, unitsData) }}</template>
					</vxe-column> -->

					<vxe-column width="100" field="managerId" title="经办人" :edit-render="{ type: 'default' }">
						<template v-slot:edit="scope">
							<el-select clearable filterable v-model="scope.row.managerId">
								<el-option v-for="item in operator" :key="item.id" :label="item.contactPerson" :value="item.id"></el-option>
							</el-select>
						</template>

						<template v-slot="{ row }">{{ getSelectLabel_contactPerson(row.managerId, operator) }}</template>
					</vxe-column>

					<vxe-column width="100" field="resourceTax" title="资源税" :edit-render="{ name: 'input' }">
						<template v-slot="{ row }">{{ transitionNumber(row.resourceTax) }}</template>
					</vxe-column>

					<!-- <vxe-column width="130" title="资源税" :edit-render="{ type: 'default' }">
						<template v-slot:edit="scope">
							<el-input v-model="scope.row.resourceTax" placeholder="请输入数值类型">
								<template #append>%</template>
							</el-input>
						</template>
						<template v-slot="{ row }">{{ row.resourceTax }}%</template>
					</vxe-column> -->

					<vxe-column width="130" field="invoiceId" title="发票类型" :edit-render="{ type: 'default' }">
						<template v-slot:edit="scope">
							<el-select clearable filterable v-model="scope.row.invoiceId">
								<el-option v-for="item in bankFrom.shoWData" :key="item.id" :label="item.type" :value="item.id"></el-option>
							</el-select>
						</template>
						<template v-slot="{ row }">{{ getSelectLabel_type(row.invoiceId, bankFrom.shoWData) }}</template>
					</vxe-column>

					<vxe-column width="60" field="invalid" title="作废" :edit-render="{ name: '$select', options: isCancellation }"></vxe-column>

					<vxe-column title="操作" fixed="right" width="80">
						<template #default="{ row }">
							<!-- <div style="display: flex; align-items: center; justify-content: space-between">
							<el-select v-model="fileValue" placeholder="点击下载对应文件" style="width: 200px" filterable>
								<el-option v-for="item in fileOptions" :key="item.value" :label="item.label" :value="item.value"> </el-option>
							</el-select>
								</div> -->
							<vxe-button status="primary" @click="copyBtn(row)">复制</vxe-button>
							<!-- <vxe-button @click="backupsreduction_button(row)">下载图片</vxe-button> -->
						</template>
					</vxe-column>
				</vxe-table>
			</div>
		</el-card>

		<!-- 弹窗 -->
		<vxe-modal v-model="drawer" title="基本变量设置%" width="700" height="300" show-zoom resize remember>
			<template #default>
				<vxe-form :data="basicsVarSer" title-align="right" title-width="100">
					<!-- <vxe-form-item title="城建税" field="buildTax" span="12" :item-render="{ name: 'input', attrs: { placeholder: '城建税' } }"></vxe-form-item> -->
					<vxe-form-item title="城建税" span="12" field="buildTax" :item-render="{}">
						<template #default="{ data }">
							<el-input v-model="data.buildTax" placeholder="请输入数值类型">
								<template #append>%</template>
							</el-input>
						</template>
					</vxe-form-item>

					<!-- <vxe-form-item
						title="教育费附加"
						field="education"
						span="12"
						:item-render="{ name: 'input', attrs: { placeholder: '教育费附加' } }"
					></vxe-form-item> -->

					<vxe-form-item title="教育费附加税" span="12" field="education" :item-render="{}">
						<template #default="{ data }">
							<el-input v-model="data.education" placeholder="请输入数值类型">
								<template #append>%</template>
							</el-input>
						</template>
					</vxe-form-item>

					<!-- <vxe-form-item
						title="地方教育附加"
						field="localEducation"
						span="12"
						:item-render="{ name: 'input', attrs: { placeholder: '地方教育附加' } }"
					></vxe-form-item> -->

					<vxe-form-item title="地方教育附加" span="12" field="localEducation" :item-render="{}">
						<template #default="{ data }">
							<el-input v-model="data.localEducation" placeholder="请输入数值类型">
								<template #append>%</template>
							</el-input>
						</template>
					</vxe-form-item>

					<!-- <vxe-form-item
						title="企业所得税"
						field="corporateIncomeTax"
						span="12"
						:item-render="{ name: 'input', attrs: { placeholder: '企业所得税' } }"
					></vxe-form-item> -->

					<vxe-form-item title="企业所得税" span="12" field="corporateIncomeTax" :item-render="{}">
						<template #default="{ data }">
							<el-input v-model="data.corporateIncomeTax" placeholder="请输入数值类型">
								<template #append>%</template>
							</el-input>
						</template>
					</vxe-form-item>

					<!-- <vxe-form-item
						title="技术咨询费"
						field="managementFee"
						span="12"
						:item-render="{ name: 'input', attrs: { placeholder: '技术咨询费' } }"
<<<<<<< HEAD
					></vxe-form-item> -->
					<vxe-form-item title="技术咨询费" span="12" field="tax" :item-render="{}">
						<template #default="{ data }">
							<el-input v-model="data.managementFee" placeholder="请输入数值类型">
								<template #append>%</template>
							</el-input>
						</template>
					</vxe-form-item>

					<!-- <vxe-form-item title="所得税" field="tax" span="12" :item-render="{ name: 'input', attrs: { placeholder: '所得税' } }"></vxe-form-item> -->
					<vxe-form-item title="所得税" span="12" field="tax" :item-render="{}">
						<template #default="{ data }">
							<el-input v-model="data.tax" placeholder="请输入数值类型">
								<template #append>%</template>
							</el-input>
						</template>
					</vxe-form-item>
					<!-- <vxe-form-item
						title="一类提成额"
						field="firstClassCommission"
						span="12"
						:item-render="{ name: 'input', attrs: { placeholder: '一类提成额' } }"
					></vxe-form-item>
					<vxe-form-item
						title="二类提成额"
						field="secondClassCommission"
						span="12"
						:item-render="{ name: 'input', attrs: { placeholder: '二类提成额' } }"
					></vxe-form-item> -->

					<vxe-form-item align="center" span="24">
						<template #default>
							<vxe-button type="submit" status="primary" @click="showSubmit">保 存</vxe-button>
							<vxe-button @click="drawer = false">取消</vxe-button>
						</template>
					</vxe-form-item>
				</vxe-form>
			</template>
		</vxe-modal>

		<!-- 新建单位名称 -->
		<vxe-modal v-model="addressBookFromIsshow" title="新建单位名" width="600" height="400" show-zoom resize remember>
			<template #default>
				<vxe-form :data="basicsVarSer" title-align="right" title-width="100">
					<vxe-form-item
						title="单位名称"
						field="unitName"
						span="12"
						:item-render="{ name: 'input', attrs: { placeholder: '请输入城建税' } }"
					></vxe-form-item>
					<vxe-form-item
						title="纳税人识别号"
						field="taxpayerNum"
						span="12"
						:item-render="{ name: 'input', attrs: { placeholder: '请输入教育税' } }"
					></vxe-form-item>

					<vxe-form-item
						title="地址电话"
						field="addressPhone"
						span="12"
						:item-render="{ name: 'input', attrs: { placeholder: '请输入地方税' } }"
					></vxe-form-item>

					<vxe-form-item
						title="开户行"
						field="accountBank"
						span="12"
						:item-render="{ name: 'input', attrs: { placeholder: '请输入个人税' } }"
					></vxe-form-item>

					<vxe-form-item
						title="开户行账号"
						field="bankAccount"
						span="12"
						:item-render="{ name: 'input', attrs: { placeholder: '请输入企业税' } }"
					></vxe-form-item>

					<vxe-form-item
						title="联系人"
						field="contactPerson"
						span="12"
						:item-render="{ name: 'input', attrs: { placeholder: '请输入企业税' } }"
					></vxe-form-item>
					<vxe-form-item
						title="联系电话1"
						field="phone1"
						span="12"
						:item-render="{ name: 'input', attrs: { placeholder: '请输入企业税' } }"
					></vxe-form-item>
					<vxe-form-item
						title="联系电话2"
						field="phone2"
						span="12"
						:item-render="{ name: 'input', attrs: { placeholder: '请输入企业税' } }"
					></vxe-form-item>
					<vxe-form-item title="联系地址" field="addr" span="12" :item-render="{ name: 'input', attrs: { placeholder: '请输入企业税' } }">
					</vxe-form-item>

					<vxe-form-item title="单位类型" field="type" span="12" :item-render="{ name: 'input', attrs: { placeholder: '请输入企业税' } }">
					</vxe-form-item>
					<vxe-form-item align="center" span="24">
						<template #default>
							<vxe-button type="submit" status="primary" @click="showSubmit_unit">保 存</vxe-button>
							<vxe-button @click="addressBookFromIsshow = false">取消</vxe-button>
						</template>
					</vxe-form-item>
				</vxe-form>
			</template>
		</vxe-modal>
		<!-- <Addunit :addressBookFromIsshow="addressBookFromIsshow"></Addunit> -->

		<!-- 弹窗 -->
		<vxe-modal v-model="bankFrom.isshow" title="发票类型" width="600" height="420" show-zoom resize remember>
			<template #default>
				<vxe-toolbar perfect>
					<template #buttons>
						<vxe-button icon="fa fa-plus" status="perfect" content="新增" @click="addbankShow"></vxe-button>
						<vxe-button icon="fa fa-trash-o" status="perfect" content="删除" @click="deleteTable_show"></vxe-button>
					</template>
				</vxe-toolbar>
				<vxe-table
					border
					:height="300"
					show-overflow
					ref="xTableShow"
					:data="bankFrom.shoWData"
					:edit-config="{ trigger: 'click', mode: 'row', showStatus: true }"
					@checkbox-all="selectAllChangeEvent1_show"
					@checkbox-change="selectChangeEvent1_show"
					@edit-closed="editClosedEvent_show"
				>
					<vxe-column type="checkbox" width="60" align="center"></vxe-column>
					<vxe-column type="seq" width="60" align="center"></vxe-column>
					<vxe-column field="type" title="发票类型" width="400" :edit-render="{ name: 'input' }"></vxe-column>
				</vxe-table>
			</template>
		</vxe-modal>

		<!-- 利率弹窗 -->
		<vxe-modal v-model="taxFrom.isshow" title="税率" width="600" height="420" show-zoom resize remember>
			<template #default>
				<vxe-toolbar perfect>
					<template #buttons>
						<vxe-button icon="fa fa-plus" status="perfect" content="新增" @click="addShow"></vxe-button>
						<vxe-button icon="fa fa-trash-o" status="perfect" content="删除" @click="delete_show"></vxe-button>
					</template>
				</vxe-toolbar>
				<vxe-table
					border
					:height="300"
					show-overflow
					ref="xTableShow"
					:data="taxFrom.shoWData"
					:edit-config="{ trigger: 'click', mode: 'row', showStatus: true }"
					@checkbox-all="selectAllChangeEvent1_show_tax"
					@checkbox-change="selectChangeEvent1_show_tax"
					@edit-closed="editClosedEvent_show_tax"
				>
					<vxe-column type="checkbox" width="60" align="center"></vxe-column>
					<vxe-column type="seq" width="60" align="center"></vxe-column>
					<!-- <vxe-column field="taxRate" title="税率" :edit-render="{ name: 'input' }"></vxe-column> -->

					<vxe-column field="taxRate" title="税率" :edit-render="{ type: 'default' }">
						<template v-slot:edit="scope">
							<el-input v-model="scope.row.taxRate" placeholder="请输入数值类型">
								<template #append>%</template>
							</el-input>
						</template>
						<template v-slot="{ row }">{{ row.taxRate }}%</template>
					</vxe-column>
				</vxe-table>
			</template>
		</vxe-modal>
	</div>
</template>

<script lang="ts">
import { toRefs, reactive, ref, toRaw, onMounted, nextTick } from 'vue';
import {
	axios_selOne, //复制
	axios_getInvoiceLedgerTableData,
	axios_selListByContractUnitId,
	axios_selListByContractUnit,
	axios_BasicsVar,
	axios_amendBasicsVar,
	axios_billDell,
	// 发票类型的东西
	axios_invoiceselList,
	axios_invoiup,
	axios_invoiadd,
	axios_invoicedel,
	// 编辑表格
	axios_billup,
	axios_billadd,
	// 计算产品值
	axios_selValue_count,
	axios_selValue_prepaidVat, //计算城建税 教育费附加 地方教育费附加 小计 企业所得税
	axios_selValue_selValue_unitPrice, //计算单价 单价=开票金额/(1+税率)
	axios_billselCodeNum, //发票台账新增
	axios_selValue_calculate, //增值税额
} from '/@/api/invoiceLedger/index';

// 利率的方法
import { axios_taxList, axios_taxadd, axios_taxup, axios_taxdel } from '/@/api/basicsUrl/index';

import { axios_SelList } from '/@/api/basicsUrl/index';

import { axios_contactsAdd } from '/@/api/addressBook/index'; //新增通讯录

import { VXETable, VxeTableInstance, VxeTableEvents, VxePulldownInstance, VxeTablePropTypes } from 'vxe-table';
import { ElMessage, ElMessageBox } from 'element-plus';

import { axios_selListByPaymentUnitIdNEWS } from '/@/api/customerDetails/index'; //通过单位查询项目

import { axios_excelbill } from '/@/api/basicsUrl/index'; //通过单位查询项目

// 不重复id
import { GenNonDuplicateID } from '/@/utils/formatTime';
import { transitionNumber } from '/@/utils/transitionNumber';

// 导入组件
// import Addunit from './../../../components/erpPage/Addunit.vue';

export default {
	name: 'InvoiceLedger',
	// components: { Addunit },
	setup() {
		const xTable1 = ref({} as VxeTableInstance);
		const xDown1 = ref({} as VxePulldownInstance);
		const xDown2 = ref({} as VxePulldownInstance);
		const xToolbar = ref({} as VxeToolbarInstance);

		const validRules = ref({
			time: [{ required: true, message: '开票时间必填' }],
			taxRate: [{ required: true, message: '税率必填' }],
			contractUnitId: [{ required: true, message: '单位名称必选' }],
			contractId: [{ required: true, message: '项目名称必选' }],
			billMoney: [{ required: true, message: '开票金额必填' }],
			prepaidVat: [{ required: true, message: '预交增值税必填' }],
		} as VxeTablePropTypes.EditRules);

		// 打印样式
		// 打印样式
		const printStyle = `
            .title {
              text-align: center;
            }
            .my-list-row {
              display: inline-block;
              width: 100%;
            }
            .my-list-col {
              float: left;
              width: 33.33%;
              height: 28px;
              line-height: 28px;
            }
            .my-top,
            .my-bottom {
              font-size: 12px;
            }
            .my-top {
              margin-bottom: 5px;
            }
            .my-bottom {
              margin-top: 30px;
              text-align: right;
            }
            `;

		// 打印顶部内容模板
		const topHtml = `
            <h1 class="title">出货单据</h1>
            <div class="my-top">
              <div class="my-list-row">
                <div class="my-list-col">商品名称： </div>
                <div class="my-list-col">发货单号：X2665847132654</div>
                <div class="my-list-col">发货日期：2020-09-20</div>
              </div>
              <div class="my-list-row">
                <div class="my-list-col">收货姓名： </div>
                <div class="my-list-col">收货地址：火星第七区18号001</div>
                <div class="my-list-col">联系电话：10086</div>
              </div>
            </div>
            `;

		// 打印底部内容模板
		const bottomHtml = `
            <div class="my-bottom">
              <div class="my-list-row">
                <div class="my-list-col"></div>
                <div class="my-list-col">创建人： </div>
                <div class="my-list-col">创建日期：2020-09-20</div>
              </div>
            </div>
            `;

		let defaultBlankDataShow = [
			{
				iswebAdd: true,
				webid: GenNonDuplicateID(),
				type: '', //发票类型
			},
		];

		let defaultTaxShow = [
			{
				iswebAdd: true,
				webid: GenNonDuplicateID(),
				taxRate: '', //税率
			},
		];

		/**
		 * @Author: lilin_:）
		 * @name: 默认空白数组
		 * @Descripttion:
		 * @param {*}
		 * @return {*}
		 */
		let defaultBlankData = [
			{
				iswebAdd: true,
				webid: GenNonDuplicateID(),
				id: '',
				time: '',
				billCode: '',
				billNum: '',
				contractId: '',
				contractUnitId: '',
				contractUnit: '',
				contractName: '',
				contractNameList1: [],
				contractNameList2: [],
				monthProgress: '',
				countProgress: '',
				billMoney: '',
				taxRate: '',
				unitPrice: '0',
				vat: '',
				prepaidVat: '',
				subcontractorId: '',
				subcontractorName: '',
				subcontractorDeductible: '',
				subcontractorDeductibleVat: '',
				buildTax: '',
				education: '',
				localEducation: '',
				subtotal: '',
				personalIncomeTax: '',
				corporateIncomeTax: '',
				stampDuty: '',
				unionFunds: '',
				waterFunds: '',
				managerId: '',
				managerName: '',
				resourceTax: '',
				invoiceId: '',
				invoiceType: '1',
				invalid: 0,
				newTime: '',
			},
		];

		// 单位名称数据
		let data1: any = [
			// {
			// 	accountBank: '重庆江北分行',
			// 	addr: '重庆江北',
			// 	addressPhone: '重庆江北 1616161',
			// 	bankAccount: '6217003764489487893',
			// 	bankName: '中国银行',
			// 	contactPerson: '高峰',
			// 	id: 6,
			// 	phone1: '13464415',
			// 	phone2: '12313133',
			// 	qq: '15313513',
			// 	taxpayerNum: 'SDGBNC',
			// 	type: 2,
			// 	unitName: '单位测试10',
			// },
		];
		// 项目名称

		const state: any = reactive({
			addList: [], //前端加的数据
			responseData: [], //后端返回的数据
			bankFrom: {
				isshow: false, //弹窗控制
				shoWData: [], //表格数据
				selectData: [], //多选的数据
			},

			drawer: false, //基础变量设置
			basicsVarSer: {
				id: '',
				buildTax: '', //城建税
				education: '', //教育费附加
				localEducation: '', //地方教育附加
				corporateIncomeTax: '', //企业所得税
				managementFee: '', //技术咨询费
				tax: '', //所得税
				firstClassCommission: '', //一类提成额
				secondClassCommission: '', //二类提成

				//  stampTax:'',//印花税
			}, //基础变量设置
			// 暂时不需要
			addressBookFromIsshow: false,
			addressBookFrom: {
				unitName: '', //单位名称s
				taxpayerNum: '', //纳税人识别号
				addressPhone: '',
				accountBank: '',
				bankAccount: '',
				bankName: '',
				contactPerson: '',
				phone1: '',
				phone2: '',
				qq: '',
				addr: '',
				type: '',
			},

			unitsData: [], //单位搜索的数据
			projectData: [], //项目数据
			operator: [], //经办人名称

			options: [
				{
					value: '1',
					label: '是',
				},
				{
					value: '0',
					label: '否',
				},
			],
			selectData: [], //选择的数据
			selectFrom: {
				on: 0, //默认是0，1是点击
				time1: '', //时间
				time2: '', //结束时间
				contractUnit: '', //单位名称
				contractName: '', //项目名称
				billMoneyStart: '', //金额范围 例：14.55-80.44 kais
				billMoneyEND: '', //jin金额范围结束
				managerName: '', //经办人姓名 12.16改成发票类型
				invalid: '', //是否作废
				tax: '', //税率
				title: {
					v1: 0,
					v2: 0,
					v3: 0,
					v4: 0,
					v5: 0,
					v6: 0,
					v7: 0,
					v8: 0,
					v9: 0,
					v10: 0,
					v11: 0,
					v12: 0,
					v13: 0,
					v14: 0,
					v15: 0,
					v16: 0,
				}, //合计数据
			},
			// 单位名称数据表格
			projectName: data1,
			// 是否作废  是否作废 1是(默认) 0否
			isCancellation: [
				{ label: '是', value: '1' },
				{ label: '否', value: '0' },
			],
			// 表格数据
			invoiceLedgerTableData: [],
			// 发票弹窗
			taxFrom: {
				isshow: false, //弹窗控制
				shoWData: [], //表格数据
				selectData: [], //多选的数据
			},
		});

		// 此处是发票类型的方法

		// 获取发票类型
		const getinvoiceType = async () => {
			let { code, obj } = await axios_invoiceselList();
			console.log(code, obj, '获取发票类型');
			if (code == 200) {
				state.bankFrom.shoWData = obj;
			}
		};

		// 新增发票类型方式
		const add_shouw = () => {
			getinvoiceType();
			state.bankFrom.isshow = true;
		};

		const selectAllChangeEvent1_show: VxeTableEvents.CheckboxAll = ({ checked, records }: any) => {
			console.log(checked ? '所有勾选事件' : '所有取消事件', records);
			state.bankFrom.selectData = records;
		};

		const selectChangeEvent1_show: VxeTableEvents.CheckboxChange = ({ checked, records }: any) => {
			state.bankFrom.selectData = records;
			console.log(checked ? '勾选事件' : '取消事件', records);
		};

		//实时更新弹窗
		const editClosedEvent_show: VxeTableEvents.EditClosed = ({ row, column }) => {
			// let getRow: any = row;
			if (row.iswebAdd) {
				// 走保存接口
				axios_invoiadd(row).then((res) => {
					// console.log(res, '是否啊添加');
					if (res.code == 200) {
						getinvoiceType();
					}
				});
			} else {
				axios_invoiup(row).then((res) => {
					if (res.code == 200) {
						getinvoiceType();
					}
				});
			}
		};
		// 编辑表格
		const showAmendFun = () => {
			if (state.selectData.length == 1) {
				let row = state.selectData[0];
				row.hghligHt = true;
				const $table = xTable1.value;
				$table.setActiveRow(row);
			} else if (state.selectData.length == 0) {
				VXETable.modal.message({ content: '您还没有选中行', status: 'warning' });
			} else {
				VXETable.modal.message({ content: '只能选中一行编辑', status: 'warning' });
			}
		};

		// 银行数据新增
		const addbankShow = () => {
			let addArry = defaultBlankDataShow.map((item: any) => {
				return {
					...item,
					...{
						webid: GenNonDuplicateID(),
					},
				};
			});
			state.bankFrom.shoWData = JSON.parse(JSON.stringify([...state.bankFrom.shoWData, ...addArry]));
			// console.log(toRaw(state.tableData), '11111111111');
			ElMessage.success({
				message: '新增1行空白栏',
				type: 'success',
			});
		};

		// 弹窗删除
		const deleteTable_show: any = async () => {
			let webAddArry: any = [];
			let reeData: any = [];
			state.bankFrom.selectData.forEach((item: any) => {
				if (item.iswebAdd == true) {
					webAddArry.push(item);
				} else {
					reeData.push(item);
				}
			});
			// 判断前端数据是否有值
			let webDelet = () => {
				if (webAddArry.length != 0) {
					// 前端删除
					state.bankFrom.shoWData = state.bankFrom.shoWData.filter((item: any) => {
						return !webAddArry.find((_item: any) => _item.webid === item.webid);
					});
				}
			};

			let resDelet = async () => {
				if (reeData.length != 0) {
					let { code }: object = await axios_invoicedel(
						reeData.map((item: any) => {
							return item.id;
						})
					);
					// console.log(code, '11111111');
					if (code == 200) {
						getinvoiceType();
					}
				}
			};
			await resDelet();
			await webDelet();
		};

		// --------------------------------------------------
		/**
		 * @Author: lilin_:）
		 * @name: 新增空白行
		 * @Descripttion:
		 * @param {*}
		 * @return {*}
		 */
		const addDefaultBlank = async () => {
			let { code, data }: any = await axios_billselCodeNum();
			if (code == 200) {
				defaultBlankData[0].billCode = data.code;
				defaultBlankData[0].billNum = data.num;
				let addArry = defaultBlankData.map((item: any) => {
					return {
						...item,
						...{
							webid: GenNonDuplicateID(),
							hghligHt: true,
						},
					};
				});
				// state.invoiceLedgerTableData = JSON.parse(JSON.stringify([...state.invoiceLedgerTableData, ...addArry]));
				let row = addArry[0];
				// let showArry = JSON.parse(JSON.stringify(state.invoiceLedgerTableData)); // state.responseData.push(row);
				state.addList.unshift(row);
				state.invoiceLedgerTableData = [...state.responseData, ...state.addList];

				const $table = xTable1.value;
				$table.clearCheckboxRow();
				$table.toggleCheckboxRow(state.addList[0]); //默认选中第一行
				state.selectData = [state.addList[0]]; //拿到选择数据
				$table.setActiveRow(row);
				// state.invoiceLedgerTableData = [...state.responseData, ...state.addList];
				ElMessage.success({
					message: '新增1行空白栏',
					type: 'success',
				});

				// 计算滚动高度
				let heightpx = state.responseData.length * 47;
				setTimeout(() => {
					document.getElementsByClassName('vxe-table--body-wrapper')[0].scrollTo(0, heightpx);
				}, 100);
				// console.log(toRaw(state.invoiceLedgerTableData), '11111111111');
			}
		};
		/**
		 * @Author: lilin_:）
		 * @name: 删除数据
		 * @Descripttion:
		 * @param {*}
		 * @return {*}
		 */
		const deleteTable: any = async () => {
			let webAddArry: any = [];
			let reeData: any = [];
			state.selectData.forEach((item: any) => {
				if (item.iswebAdd == true) {
					webAddArry.push(item);
				} else {
					reeData.push(item);
				}
			});
			// 判断前端数据是否有值
			let webDelet = () => {
				if (webAddArry.length != 0) {
					// 前端删除
					state.addList = state.addList.filter((item: any) => {
						return !webAddArry.find((_item: any) => _item.webid === item.webid);
					});

					state.selectData = [];
					state.invoiceLedgerTableData = [...state.responseData, ...state.addList];
				}
			};

			let resDelet = async () => {
				if (reeData.length != 0) {
					let { code }: object = await axios_billDell(
						reeData.map((item: any) => {
							return item.id;
						})
					);
					// console.log(code, '11111111');
					if (code == 200) {
						state.selectFrom.on = 1; // //默认是0，1是点击
						getInvoiceLedgerTableData();
					}
				}
			};
			await resDelet();
			await webDelet();

			//删除后台数据

			// console.log(toRaw(webAddArry), '前端的东西');
			// console.log(toRaw(reeData), '后台返回的数据');
			// console.log(toRaw(state.selectData), '11111111111');
		};

		/**
		 * @Author: lilin_:）
		 * @name: 获取发票台账数据
		 * @Descripttion:
		 * @param {*}
		 * @return {*}
		 */
		const getInvoiceLedgerTableData = async () => {
			// let time1 = '';
			// if (state.selectFrom.time) {
			// 	time1 = `${state.selectFrom.time[0]}_${state.selectFrom.time[1]}`;
			// }
			let data = {
				time1: state.selectFrom.time1, //开始时间
				time2: state.selectFrom.time2, //结束
				on: state.selectFrom.on, // //默认是0，1是点击
				contractUnitId: state.selectFrom.contractUnit, //单位ID
				contractId: state.selectFrom.contractName, //项目ID
				billMoney: `${state.selectFrom.billMoneyStart}-${state.selectFrom.billMoneyEND}`, //金额范围 例：14.55-80.44
				invoiceId: state.selectFrom.managerName, //经办人ID
				invalid: state.selectFrom.invalid, //是否作废
				taxRate: state.selectFrom.tax, //税率
			};

			// console.log(toRaw(data), 'params,我是搜索的参数');
			let resData: any = await axios_getInvoiceLedgerTableData(data);

			if (resData.code == 200) {
				// 重置数据
				state.addList = [];
				// 添加20条数据
				for (let index = 0; index < 20; index++) {
					state.addList.push(
						defaultBlankData.map((item: any) => {
							return {
								...item,
								...{
									webid: GenNonDuplicateID(),
									billCode: '',
									billNum: '',
								},
							};
						})[0]
					);
				}
				state.responseData = resData.obj;
				state.invoiceLedgerTableData = [...state.responseData, ...state.addList];
				// state.invoiceLedgerTableData = JSON.parse(JSON.stringify([...resData.obj, ...defaultBlankData]));
				state.selectFrom.title = resData.data;
				state.selectData = []; //解决保存后没选择数据还能保存
			}
		};

		/**
		 * @Author: lilin_:）
		 * @name: 获取项目名称
		 * @Descripttion:
		 * @param {*}
		 * @return {*}
		 */
		const getProjectName = async () => {
			let resData: any = await axios_SelList({ unitName: '', contactPerson: '', type: '2' });
			state.unitsData = resData.obj;
			data1 = resData.obj;
			console.log(resData.obj, '我是单位名称');
		};
		// const getOperator = async () => {
		// 	let resData: any = await axios_SelList({ unitName: '', contactPerson: '', type: '3' });
		// 	state.operator = resData.obj;
		// 	console.log(resData.obj, '经办人');
		// };

		// 单位名称搜索
		const clickDownEvent = (e: any) => {
			const $pulldown1 = xDown1.value;
			let changeValue = e.value;
			console.log(e, '1111111111');
			// console.log(e2,'2222222')
			if ($pulldown1) {
				$pulldown1.showPanel();
				// state.projectName = changeValue ? data1.filter((item) => item.unitName.indexOf(changeValue) > -1) : data1;
				if (changeValue) {
					// state.projectName = data1.filter((item: any) => {
					// 	item.unitName.indexOf(changeValue) > -1;
					// });
					let isinclude = [];
					// let noinclude = [];

					isinclude = data1.filter((item: any) => {
						return item.unitName.indexOf(changeValue) > -1;
					});
					// noinclude = data1.filter((item: any) => {
					// 	return item.unitName.indexOf(changeValue) == -1;
					// });
					if (isinclude.length == 0) {
						state.projectName = [
							{
								unitName: '新增数据',
							},
						];
					} else {
						state.projectName = isinclude;
					}
				} else {
					state.projectName = data1;
				}
			}
		};
		// 单位名称点击去确定
		const changeNameEvent = (item: any, row: any) => {
			console.log(toRaw(item), '1111111');
			const $pulldown1 = xDown1.value;
			row.contractUnit = item.unitName;
			// console.log(item, '11111111');
			console.log('我执行到了1');
			// 清空项目名称
			row.contractName = '请删从新选择';

			// 更换了
			let getItmeData = async () => {
				// 获取对应项目名称添加到对象
				let resData: any = await axios_selListByContractUnitId({ id: item.item });
				row.data1 = resData.obj;
				row.yuanData = resData.obj;
				console.log(toRaw(row), '1111111111');
				console.log(toRaw(resData), '22222222');
			};
			getItmeData();

			if ($pulldown1) {
				$pulldown1.hidePanel();
			}
		};

		// 项目名称
		const clickDownEvent_xDown2 = (row: any) => {
			const $pulldown1 = xDown2.value;
			let changeValue = row.contractName;
			console.log(changeValue, '输入的值');

			row.yuanData = changeValue ? row.data1.filter((item) => item.contractName.indexOf(changeValue) > -1) : row.data1;

			if ($pulldown1) {
				$pulldown1.showPanel();
			}
		};
		// 项目名称点击
		const changeNameEvent_xDown2 = (item: any, row: any) => {
			// 判断是否新增
			if (item.contractName == '新增数据') {
				console.log('我是新增');
			} else {
				const $pulldown1 = xDown2.value;
				row.contractName = item.contractName;
				console.log('新增数据111');
				if ($pulldown1) {
					$pulldown1.hidePanel();
				}
			}
			// console.log(item, row);
		};
		const selectAllChangeEvent1: VxeTableEvents.CheckboxAll = ({ checked, records }: any) => {
			console.log(checked ? '所有勾选事件' : '所有取消事件', records);
			state.selectData = records;
		};

		const selectChangeEvent1: VxeTableEvents.CheckboxChange = ({ checked, records }: any) => {
			// 重置所有高亮
			state.invoiceLedgerTableData.forEach((item2: any) => {
				item2.hghligHt = false;
			});
			console.log(checked ? '勾选事件' : '取消事件', records);
			state.selectData = records;
			// 新增打勾选项
			state.selectData.forEach((item: any) => {
				if (item.iswebAdd) {
					// 前端的数据
					state.invoiceLedgerTableData.forEach((item2: any) => {
						if (item.webid == item2.webid) {
							item2.hghligHt = true;
						}
					});
				} else {
					state.invoiceLedgerTableData.forEach((item2: any) => {
						if (item.id == item2.id) {
							item2.hghligHt = true;
						}
					});
				}
			});
		};

		const searchEvent: VxeFormEvents.Submit = async () => {
			// VXETable.modal.message({ content: '查询事件', status: 'info' });
			state.selectFrom.on = 1; // //默认是0，1是点击
			await getInvoiceLedgerTableData();
		};

		/**
		 * @Author: lilin_:）
		 * @name: 重置搜索表单
		 * @Descripttion:
		 * @param {*}
		 * @return {*}
		 */
		const resetEvent: VxeFormEvents.Reset = async () => {
			state.selectFrom.time1 = ''; //清空时间
			state.selectFrom.time2 = ''; //清空时间
			state.selectFrom.on = 0; // //默认是0，1是点击
			state.selectFrom.contractUnit = ''; //单位名称
			state.selectFrom.contractName = ''; //项目名称
			state.selectFrom.billMoneyStart = ''; //金额范围
			state.selectFrom.billMoneyEND = ''; //金额范围
			state.selectFrom.managerName = ''; //经办人姓名 改成发票类型
			state.selectFrom.invalid = ''; //是否作废
			state.selectFrom.tax = ''; //tax税率
			await getInvoiceLedgerTableData();
			// VXETable.modal.message({ content: '重置事件', status: 'info' });
		};

		/**
		 * @Author: lilin_:）
		 * @name: 获取对应项目名称
		 * @Descripttion:
		 * @param {*}
		 * @return {*}
		 */
		const change_contractName = async (item: any) => {
			console.log(toRaw(item), '11111111111111111');
			let { code, obj } = await axios_selListByPaymentUnitIdNEWS({
				contractUnitId: item.contractUnitId,
			});
			if (code == 200) {
				console.log(obj, '1111111111');
				if (item.iswebAdd) {
					// 前端的数据
					state.invoiceLedgerTableData.forEach((item_data, itemdata_index) => {
						if (item_data.webid == item.webid) {
							// console.log(itemdata_index,'itemdata_index')
							item_data.contractNameList1 = obj;
						}
					});
				} else {
					state.invoiceLedgerTableData.forEach((item_data, itemdata_index) => {
						if (item_data.id == item.id) {
							// console.log(itemdata_index,'itemdata_index')
							item_data.contractNameList1 = obj;
						}
					});
				}
			}

			// if (item.unitName == '新增数据') {
			// 	state.addressBookFromIsshow = true;
			// 	console.log('我进来了');
			// }
			// console.log(value,'any')
		};

		// 新增发票类型
		let addinvoiceType = async () => {
			let a = await axios_billselCodeNum();

			console.log(a, '1111111111111111111');
		};
		let onMounted_joint = async () => {
			let { code, data } = await axios_billselCodeNum();
			if (code == 200) {
				defaultBlankData[0].billCode = data.code;
				defaultBlankData[0].billNum = data.num;
				state.selectFrom.on = 0; // //默认是0，1是点击
				getInvoiceLedgerTableData();
			}

			// console.log(a, '1111111111111111111');
		};

		onMounted(() => {
			onMounted_joint(); //拼接数据
			getProjectName(); //单位名称
			getProjectData(); //项目名称
			// getOperator(); //获取经办人姓名
			getinvoiceType(); //获取发票类型
			taxListFun(); //获取税率

			// let a = GenNonDuplicateID()
			// console.log(a)
		});
		//实时更新
		const editClosedEvent: VxeTableEvents.EditClosed = ({ row, column }) => {
			// console.log(toRaw(row), '11111');

			if (state.selectData.length == 1) {
				let row = state.selectData[0];
				if (row.iswebAdd) {
					// 走保存接口
					axios_billadd(row).then((res) => {
						if (res.code == 200) {
							state.selectFrom.on = 1; // //默认是0，1是点击
							getInvoiceLedgerTableData(); //列表
							VXETable.modal.message({ content: '新增成功!', status: 'success' });
						}
					});
				} else {
					axios_billup(row).then((res) => {
						if (res.code == 200) {
							state.selectFrom.on = 1; // //默认是0，1是点击
							getInvoiceLedgerTableData(); //列表
							VXETable.modal.message({ content: '编辑成功！', status: 'success' });
						}
					});
				}
			} else if (state.selectData.length == 0) {
				VXETable.modal.message({ content: '您还没有选中行', status: 'warning' });
			} else {
				VXETable.modal.message({ content: '只能选中一行编辑', status: 'warning' });
			}
		};
		/**
		 * @Author: lilin_:）
		 * @name: 获取基础变量
		 * @Descripttion:
		 * @param {*}
		 * @return {*}
		 */
		const getBasicsVar = async () => {
			let { obj, code }: any = await axios_BasicsVar();
			state.basicsVarSer = obj;
			if (code == 200) {
				return code;
			}
			console.log(obj, '基础变量数据');
		};

		/**
		 * @Author: lilin_:）
		 * @name: 提交修改基础变量
		 * @Descripttion:
		 * @param {*}
		 * @return {*}
		 */
		const showSubmit = async () => {
			console.log(state.basicsVarSer, 'state.basicsVarSer');

			let { code, msg } = await axios_amendBasicsVar(state.basicsVarSer);
			if (code == 200) {
				ElMessage.success({
					message: msg,
					type: 'success',
				});
				state.drawer = false;
			}
			// console.log(a, '111111111');
		};

		/**
		 * @Author: lilin_:）
		 * @name: 高级导出功能
		 * @Descripttion:
		 * @param {*}
		 * @return {*}
		 */
		const funnelEvent = () => {
			const $table = xTable1.value;
			$table.openExport();
		};

		/**
		 * @Author: lilin_:）
		 * @name: 关联表格
		 * @Descripttion:
		 * @param {*}
		 * @return {*}
		 */
		nextTick(() => {
			// 将表格和工具栏进行关联
			// const $table = xTable1.value;
			// const $toolbar = xToolbar.value;
			// $table.connect($toolbar);
		});

		// 查询当前的项目名称全部
		const getProjectData = async () => {
			let resData: any = await axios_selListByContractUnit();

			state.projectData = resData.obj;
			// console.log(  toRaw(resData) , '我三项目的数据');
		};

		//展示内容
		const showBasicsVarSet = async () => {
			let code = await getBasicsVar(); //查询基础变量

			// console.log(res,'1111111111111111111111')

			if (code == 200) {
				state.drawer = true;
			}
		};
		/**
		 * @Author: lilin_:）
		 * @name: 打印表格
		 * @Descripttion:
		 * @param {*}
		 * @return {*}
		 */
		const printTab = () => {
			const $table = xTable1.value;
			$table.print({
				sheetName: '发票台账',
				style: printStyle, //自定义样式
				columns: [
					{ field: 'time' },
					{ field: 'billCode' },
					{ field: 'billNum' },
					{ field: 'contractUnitId' },
					{ field: 'contractId' },
					{ field: 'monthProgress' },
					{ field: 'countProgress' },
					{ field: 'billMoney' },
					{ field: 'taxRate' },
					{ field: 'unitPrice' },
					{ field: 'vat' },
					{ field: 'prepaidVat' },
					{ field: 'subcontractorId' },
					{ field: 'subcontractorDeductible' },
					{ field: 'subcontractorDeductibleVat' },
					{ field: 'buildTax' },
					{ field: 'education' },
					{ field: 'localEducation' },
					{ field: 'subtotal' },
					{ field: 'personalIncomeTax' },
					{ field: 'corporateIncomeTax' },
					{ field: 'stampDuty' },
					{ field: 'unionFunds' },
					{ field: 'waterFunds' },
					{ field: 'managerId' },
					{ field: 'resourceTax' },
					{ field: 'invoiceId' },
					{ field: 'invalid' },
				],
				beforePrintMethod: ({ content }) => {
					// 拦截打印之前，返回自定义的 html 内容
					// return topHtml + content + bottomHtml;
					return content;
				},
			});
		};
		const change_select = (value, row) => {
			console.log(value, '1111111111');
			console.log(row, '2222222');
		};
		/**
		 * @Author: lilin_:）
		 * @name:搜索名称处理
		 * @Descripttion:
		 * @param {*}
		 * @return {*}
		 */
		const getSelectLabel = (value, list) => {
			let item = list.find((item) => item.id === value);
			return item ? item.unitName : null;
		};

		const getSelectLabel_contractName = (value, list) => {
			// console.log(toRaw(list), 'list');

			let item = list.find((item) => item.id === value);
			return item ? item.contractName : null;
		};

		const getSelectLabel_type = (value, list) => {
			let item = list.find((item) => item.id === value);
			return item ? item.type : null;
		};

		const getSelectLabel_contactPerson = (value, list) => {
			let item = list.find((item) => item.id === value);

			return item ? item.contactPerson : null;
		};

		/**
		 * @Author: lilin_:）
		 * @name: 关键词搜索
		 * @Descripttion:
		 * @param {*}
		 * @return {*}
		 */
		const remoteMethod = (query: any) => {
			console.log(query, '111111');

			// const $pulldown1 = xDown1.value;
			// let changeValue = e.value;

			if (query) {
				// $pulldown1.showPanel();
				// state.projectName = changeValue ? data1.filter((item) => item.unitName.indexOf(changeValue) > -1) : data1;
				if (query) {
					// state.projectName = data1.filter((item: any) => {
					// 	item.unitName.indexOf(changeValue) > -1;
					// });
					let isinclude = [];
					// let noinclude = [];
					isinclude = data1.filter((item: any) => {
						return item.unitName.indexOf(query) > -1;
					});
					// noinclude = data1.filter((item: any) => {
					// 	return item.unitName.indexOf(changeValue) == -1;
					// });
					if (isinclude.length == 0) {
						state.projectName = [
							{
								unitName: '新增数据',
							},
						];
					} else {
						state.projectName = isinclude;
					}
				} else {
					state.projectName = data1;
					// console.log('我没有值')
					// state.projectName = [
					// 	{
					// 		unitName: '新增数据',
					// 	},
					// ];
				}
			}

			// if (query !== '') {
			// 	state.projectName = data1.filter((item) => {
			// 		return item.unitName.toLowerCase().indexOf(query.toLowerCase()) > -1;
			// 	});
			// } else {
			// 	state.projectName = [
			// 		{
			// 			unitName: '新增数据',
			// 		},
			// 	];
			// }
		};

		/**
		 * @Author: lilin_:）
		 * @name:
		 * @Descripttion:
		 * @param {*}
		 * @return {*}
		 */
		const showSubmit_unit = async () => {
			let { code } = await axios_contactsAdd(state.addressBookFrom);
			console.log(code, '111111');
			if (code == 200) {
				getProjectName(); //单位名称
				state.addressBookFromIsshow = false;
			}
		};

		// 输入月进度量产量值
		let change_monthProgress = async (item: any) => {
			console.log(toRaw(item), 'YUE');

			// if (item.contractId == '' || item.monthProgress == '') {
			// 	return;
			// }

			let { code, data } = await axios_selValue_count({
				contractId: item.contractId,
				value: item.monthProgress,
			});

			console.log(code, data, 'code,obj');

			if (code == 200) {
				// 判断是否新增项目
				if (item.iswebAdd) {
					// 前端的数据
					state.invoiceLedgerTableData.forEach((item_data, itemdata_index) => {
						if (item_data.webid == item.webid) {
							// console.log(itemdata_index,'itemdata_index')
							item_data.countProgress = data.count;
						}
					});
				} else {
					state.invoiceLedgerTableData.forEach((item_data, itemdata_index) => {
						if (item_data.id == item.id) {
							// console.log(item_data.countProgress, 'itemdata_index');
							item_data.countProgress = data.count;
						}
					});
				}
			}
		};

		// 输入预交增值税

		let change_prepaidVat = async (item: any) => {
			console.log(toRaw(item), 'YUE');

			let { code, obj }: any = await axios_selValue_prepaidVat({
				prepaidVat: item.prepaidVat,
			});
			console.log(code, obj, 'code,obj');
			if (code == 200) {
				// 判断是否新增项目
				if (item.iswebAdd) {
					// 前端的数据
					state.invoiceLedgerTableData.forEach((item_data: any) => {
						if (item_data.webid == item.webid) {
							//  计算城建税 教育费附加 地方教育费附加 小计 企业所得税
							item_data.buildTax = obj.buildTax;
							item_data.education = obj.education;
							item_data.localEducation = obj.localEducation;
							item_data.subtotal = obj.subtotal;
							item_data.corporateIncomeTax = obj.corporateIncomeTax;
						}
					});
				} else {
					state.invoiceLedgerTableData.forEach((item_data: any) => {
						if (item_data.id == item.id) {
							item_data.buildTax = obj.buildTax;
							item_data.education = obj.education;
							item_data.localEducation = obj.localEducation;
							item_data.subtotal = obj.subtotal;
							item_data.corporateIncomeTax = obj.corporateIncomeTax;
						}
					});
				}
			}
		};

		//  计算增值税额
		let change_VATcollection = async (item: any) => {
			// 开票金额和单价同时存在的时候调用前端计算
			// if (item.unitPrice == '' || item.billMoney == '') {
			// 	return;
			// }
			// unitPrice单价
			console.log(toRaw(item), 'YUE11111');

			let { code, obj }: any = await axios_selValue_calculate({
				v1: item.billMoney,
				v2: item.unitPrice,
			});
			console.log(code, obj, 'code,obj');
			if (code == 200) {
				// 判断是否新增项目
				if (item.iswebAdd) {
					// 前端的数据
					state.invoiceLedgerTableData.forEach((item_data: any) => {
						if (item_data.webid == item.webid) {
							item_data.vat = obj;
							console.log(item_data, 'iswebAdd,obj');
							//   this.$refs.vxeTable.loadData(this.tableData)  //获取dom，然后调用方法
							// xTable1.value.loadData(state.invoiceLedgerTableData);
						}
					});
				} else {
					state.invoiceLedgerTableData.forEach((item_data: any) => {
						if (item_data.id == item.id) {
							item_data.vat = obj;
							console.log(item_data, '1,obj');
							// xTable1.value.loadData(state.invoiceLedgerTableData);
						}
					});
				}
			}
		};

		// 计算开票金额

		let change_sunbillMoney = async (item: any) => {
			// 判断是否有两个值
			// if (item.billMoney == '' || item.taxRate == '') {
			// 	return;
			// }

			let { code, msg }: any = await axios_selValue_selValue_unitPrice({
				billMoney: item.billMoney,
				taxRate: item.taxRate,
			});
			console.log(code, msg, 'code,obj');
			if (code == 200) {
				// 判断是否新增项目
				if (item.iswebAdd) {
					// 前端的数据
					state.invoiceLedgerTableData.forEach((item_data: any) => {
						if (item_data.webid == item.webid) {
							item_data.unitPrice = msg;
						}
					});
				} else {
					state.invoiceLedgerTableData.forEach((item_data: any) => {
						if (item_data.id == item.id) {
							item_data.unitPrice = msg;
						}
					});
				}
			}

			await change_VATcollection(item);
		};

		// 复制一行
		let copyBtn = async (row: any) => {
			if (row.iswebAdd) {
				// 提示
				ElMessage.error({
					message: '此条内容不能复制',
					type: 'error',
				});
			} else {
				let { code, obj } = await axios_selOne({ id: row.id });

				if (code == 200) {
					// let resOBJ = [];
					state.responseData.push({
						...obj,
						...{
							iswebAdd: true,
							webid: GenNonDuplicateID(),
						},
					});
					state.invoiceLedgerTableData = [...state.responseData, ...state.addList];

					// console.log(toRaw(resOBJ), 'obj');
					// console.log(toRaw(state.invoiceLedgerTableData), 'state.invoiceLedgerTableData');

					// state.invoiceLedgerTableData = JSON.parse(JSON.stringify([...state.invoiceLedgerTableData, ...resOBJ]));
					// state.invoiceLedgerTableData = state.invoiceLedgerTableData.push(obj);
				}
			}
		};

		// -------------新增利率弹窗

		let addTaxBtn = async () => {
			let { code, obj } = await axios_taxList();
			// console.log(code,'code')
			console.log(obj, 'taxFromobj');
			if (code == 200) {
				state.taxFrom.shoWData = obj;
				state.taxFrom.isshow = true;
			}
		};

		let taxListFun = async () => {
			let { code, obj } = await axios_taxList();
			// console.log(code,'code')
			// console.log(obj,'obj')
			if (code == 200) {
				state.taxFrom.shoWData = obj;
			}
		};
		//新增税率

		const addShow = () => {
			let addArry = defaultTaxShow.map((item: any) => {
				return {
					...item,
					...{
						webid: GenNonDuplicateID(),
					},
				};
			});
			state.taxFrom.shoWData = JSON.parse(JSON.stringify([...state.taxFrom.shoWData, ...addArry]));
			// console.log(toRaw(state.tableData), '11111111111');
			ElMessage.success({
				message: '新增1行空白栏',
				type: 'success',
			});
		};

		// 弹窗删除
		const delete_show: any = async () => {
			let webAddArry: any = [];
			let reeData: any = [];
			state.taxFrom.selectData.forEach((item: any) => {
				if (item.iswebAdd == true) {
					webAddArry.push(item);
				} else {
					reeData.push(item);
				}
			});
			// 判断前端数据是否有值
			let webDelet = () => {
				if (webAddArry.length != 0) {
					// 前端删除
					state.taxFrom.shoWData = state.taxFrom.shoWData.filter((item: any) => {
						return !webAddArry.find((_item: any) => _item.webid === item.webid);
					});
				}
			};

			let resDelet = async () => {
				if (reeData.length != 0) {
					let { code }: object = await axios_taxdel(
						reeData.map((item: any) => {
							return item.id;
						})
					);
					// console.log(code, '11111111');
					if (code == 200) {
						let { code, obj } = await axios_taxList();
						if (code == 200) {
							state.taxFrom.shoWData = obj;
						}
					}
				}
			};
			await resDelet();
			await webDelet();
		};

		const selectAllChangeEvent1_show_tax: VxeTableEvents.CheckboxAll = ({ checked, records }: any) => {
			console.log(checked ? '所有勾选事件' : '所有取消事件', records);
			state.taxFrom.selectData = records;
		};

		const selectChangeEvent1_show_tax: VxeTableEvents.CheckboxChange = ({ checked, records }: any) => {
			state.taxFrom.selectData = records;
			console.log(checked ? '勾选事件' : '取消事件', records);
		};

		//实时更新弹窗
		const editClosedEvent_show_tax: VxeTableEvents.EditClosed = ({ row, column }) => {
			// let getRow: any = row;
			if (row.iswebAdd) {
				// 走保存接口
				axios_taxadd(row).then((res) => {
					// console.log(res, '是否啊添加');
					if (res.code == 200) {
						taxListFun();
					}
				});
			} else {
				axios_taxup(row).then((res) => {
					if (res.code == 200) {
						taxListFun();
					}
				});
			}
		};
		// 上传文件
		let uploadingbutton = async (item: any) => {
			console.log(toRaw(item), 'item');

			try {
				const { file } = await VXETable.readFile({
					multiple: true,
				}); // 数据表 1出纳表 2合同表 3商票台账
				// let params = {
				// 	dataSheet: 3,
				// 	id: item.id,
				// };
				console.log(file, 'file');
				let formData = new FormData();
				formData.append('file', file);

				axios_excelbill(formData).then((res: any) => {
					if (res.code == 200) {
						state.selectFrom.on = 1; // //默认是0，1是点击
						getInvoiceLedgerTableData();
						VXETable.modal.alert(`共：1 个文件`);
					}
				}); // 开始处理数据
			} catch (e) {
				ElMessage.error({
					message: '上传出错啦',
					type: 'error',
				});
			}
		};

		// 合计
		const footerMethod: VxeTablePropTypes.FooterMethod = ({ columns, data }) => {
			return [
				columns.map((column, columnIndex) => {
					// console.log(columnIndex, '1');

					if (columnIndex === 2) {
						return '合计';
					}

					if (columnIndex === 7) {
						return `${state.selectFrom.title.v1}`;
					}
					// 印花税收、
					if (columnIndex === 8) {
						return `${state.selectFrom.title.v2}`;
					}
					// 技术咨询费
					if (columnIndex === 11) {
						return `${state.selectFrom.title.v3}`;
					}
					// 预交增值税
					if (columnIndex === 12) {
						return `${state.selectFrom.title.v4}`;
					}

					if (columnIndex === 14) {
						return `${state.selectFrom.title.v5}`;
					}

					if (columnIndex === 15) {
						return `${state.selectFrom.title.v6}`;
					}
					if (columnIndex === 16) {
						return `${state.selectFrom.title.v7}`;
					}
					//教育附加
					if (columnIndex === 17) {
						return `${state.selectFrom.title.v8}`;
					}
					// 地方附加

					if (columnIndex === 18) {
						return `${state.selectFrom.title.v9}`;
					}

					if (columnIndex === 19) {
						return `${state.selectFrom.title.v10}`;
					}

					if (columnIndex === 20) {
						return `${state.selectFrom.title.v11}`;
					}
					// 企业所得
					if (columnIndex === 21) {
						return `${state.selectFrom.title.v12}`;
					}

					if (columnIndex === 22) {
						return `${state.selectFrom.title.v13}`;
					}

					// 工会
					if (columnIndex === 23) {
						return `${state.selectFrom.title.v14}`;
					}

					if (columnIndex === 24) {
						return `${state.selectFrom.title.v15}`;
					}

					if (columnIndex === 26) {
						return `${state.selectFrom.title.v16}`;
					}

					return '';
				}),
			];
		};

		// 改变颜色样式
		const rowClassName: VxeTablePropTypes.RowClassName = ({ row }) => {
			// console.log(row, 'rowIndex');
			if (row.hghligHt) {
				return 'row-green';
			}
			return null;
		};

		return {
			validRules, //验证
			footerMethod, //合计
			uploadingbutton, //上传文件
			...toRefs(state),
			copyBtn, //复制一行
			xDown1,
			clickDownEvent, //单位搜索
			changeNameEvent, //单位搜索
			xDown2, //项目名称ref
			addDefaultBlank, //新增空白行
			deleteTable, //删除空白行
			selectChangeEvent1, //单选
			selectAllChangeEvent1, //全选项目名字
			change_select, //项目名字搜索
			showBasicsVarSet, //打开基础变量设置
			printTab, //打印表格
			showSubmit, //修改基础变量
			change_contractName, //新增单位名称
			showSubmit_unit, //新建单位
			getSelectLabel,
			getSelectLabel_contractName, //回显项目名称
			getSelectLabel_type, //类型显示
			getSelectLabel_contactPerson, //回显经办人
			remoteMethod,
			change_monthProgress, //月进度产量
			change_prepaidVat, //预交增值税
			change_sunbillMoney, //计算单件
			change_VATcollection, //计算增值税

			// 发票类型弹窗
			selectAllChangeEvent1_show,
			selectChangeEvent1_show,
			editClosedEvent_show,
			addbankShow,
			deleteTable_show,

			clickDownEvent_xDown2,
			changeNameEvent_xDown2,
			searchEvent,
			resetEvent,

			funnelEvent,
			editClosedEvent,
			xTable1,
			xToolbar,
			// 发票类型
			add_shouw,
			// ---------利率
			addTaxBtn,
			addShow, //新增税率
			delete_show,
			selectAllChangeEvent1_show_tax,
			selectChangeEvent1_show_tax,
			editClosedEvent_show_tax,
			transitionNumber,
			showAmendFun,
			rowClassName,
		};
	},
};
</script>

<style scoped lang="scss">
.system-user-container {
	// padding: 20px;
	background-color: #fff;
}
.top_title {
	padding: 0 20px;
}
// 金额范围搜索
.money_scope {
	display: flex;
	align-items: center;
	justify-content: space-between;
}
.money_scope el-input {
	width: 20%;
}
.mytable-style ::v-deep .vxe-body--row.row-green {
	background-color: #bbb;
	color: #fff;
}
</style>
